<template>
  <div class="features-demo-layout">
    <!-- 使用新的导航栏 -->
    <UserHomeHeader />

    <div class="features-demo">
      <!-- 页面标题 -->
      <section class="page-header">
        <div class="header-content">
          <h1>功能演示</h1>
          <p>深入了解系统的各项功能，体验强大的多语言文本处理能力</p>
        </div>
      </section>

      <!-- 功能演示内容 -->
      <section class="demo-content">
        <div class="demo-tabs">
          <el-tabs v-model="activeDemo" type="card" @tab-click="handleDemoChange">
            <el-tab-pane label="文本对齐" name="align">
              <div class="demo-showcase">
                <div class="demo-visual">
                  <div class="mockup-interface">
                    <div class="mockup-header">
                      <span>文本对齐功能</span>
                    </div>
                    <div class="mockup-content">
                      <div class="mockup-upload">
                        <div class="upload-area">
                          <el-icon><Upload /></el-icon>
                          <p>上传源语言文件</p>
                        </div>
                        <div class="upload-area">
                          <el-icon><Upload /></el-icon>
                          <p>上传目标语言文件</p>
                        </div>
                      </div>
                      <div class="mockup-result">
                        <div class="result-item">
                          <span class="chinese">源语言句子1</span>
                          <span class="vietnamese">Target language sentence 1</span>
                        </div>
                        <div class="result-item">
                          <span class="chinese">源语言句子2</span>
                          <span class="vietnamese">Target language sentence 2</span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="demo-details">
                  <h3>智能文本对齐</h3>
                  <p>采用先进的自然语言处理技术，实现中文与东盟国家语言的精准对齐。系统支持批量处理，自动识别语言特征，确保对齐结果的准确性和一致性。</p>

                  <div class="feature-list">
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>支持多种东盟语言对齐</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>高精度句子级别匹配</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>批量处理能力</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>可视化对齐结果</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>导出多种格式</span>
                    </div>
                  </div>

                  <div class="demo-actions">
                    <el-button color="var(--primary)" type="primary" size="large" @click="$router.push('/align')">
                      立即体验
                    </el-button>
                  </div>
                </div>
              </div>
            </el-tab-pane>

            <el-tab-pane label="数据清洗" name="preprocess">
              <div class="demo-showcase">
                <div class="demo-visual">
                  <div class="mockup-interface">
                    <div class="mockup-header">
                      <span>数据清洗功能</span>
                    </div>
                    <div class="mockup-content">
                      <div class="mockup-steps">
                        <div class="step-item">
                          <div class="step-number">1</div>
                          <div class="step-text">数据导入</div>
                        </div>
                        <div class="step-arrow">→</div>
                        <div class="step-item">
                          <div class="step-number">2</div>
                          <div class="step-text">智能检测</div>
                        </div>
                        <div class="step-arrow">→</div>
                        <div class="step-item">
                          <div class="step-number">3</div>
                          <div class="step-text">自动清洗</div>
                        </div>
                        <div class="step-arrow">→</div>
                        <div class="step-item">
                          <div class="step-number">4</div>
                          <div class="step-text">质量报告</div>
                        </div>
                      </div>
                      <div class="mockup-stats">
                        <div class="stat-item">
                          <span class="stat-label">重复内容</span>
                          <span class="stat-value">-234</span>
                        </div>
                        <div class="stat-item">
                          <span class="stat-label">格式错误</span>
                          <span class="stat-value">-56</span>
                        </div>
                        <div class="stat-item">
                          <span class="stat-label">编码问题</span>
                          <span class="stat-value">-12</span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="demo-details">
                  <h3>高效数据清洗</h3>
                  <p>提供全面的文本预处理功能，包括去重、格式化、编码转换等。系统采用智能算法识别数据质量问题，有效提升数据质量，为后续处理奠定坚实基础。</p>

                  <div class="feature-list">
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>智能去重算法</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>多格式支持</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>编码自动识别</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>质量评估指标</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>批量处理优化</span>
                    </div>
                  </div>

                  <div class="demo-actions">
                    <el-button color="var(--primary)" type="primary" size="large" @click="$router.push('/preprocess')">
                      立即体验
                    </el-button>
                  </div>
                </div>
              </div>
            </el-tab-pane>

            <el-tab-pane label="数据检索" name="retrieve">
              <div class="demo-showcase">
                <div class="demo-visual">
                  <div class="mockup-interface">
                    <div class="mockup-header">
                      <span>数据检索功能</span>
                    </div>
                    <div class="mockup-content">
                      <div class="mockup-search">
                        <el-input placeholder="输入搜索关键词..." model-value="东盟自由贸易区">
                          <template #suffix>
                            <el-icon><Search /></el-icon>
                          </template>
                        </el-input>
                      </div>
                      <div class="mockup-results">
                        <div class="result-item highlighted">
                          <div class="result-title">关于建立中国-<span class="highlight">东盟</span>自由贸易区的倡议</div>
                          <div class="result-snippet">...中国与<span class="highlight">东盟</span>国家经贸合作成果显著...</div>
                        </div>
                        <div class="result-item">
                          <div class="result-title"><span class="highlight">东盟</span>共同体建设进展报告</div>
                          <div class="result-snippet">...<span class="highlight">东盟</span>经济共同体发展迅速...</div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="demo-details">
                  <h3>快速数据检索</h3>
                  <p>基于先进的索引技术，实现毫秒级文本检索。系统支持多语言查询，智能匹配相关内容，快速定位所需信息，大大提升工作效率。</p>

                  <div class="feature-list">
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>多语言查询支持</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>智能相关度排序</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>高亮显示匹配内容</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>导出检索结果</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>高级搜索过滤</span>
                    </div>
                  </div>

                  <div class="demo-actions">
                    <el-button color="var(--primary)" type="primary" size="large" @click="$router.push('/retrieve')">
                      立即体验
                    </el-button>
                  </div>
                </div>
              </div>
            </el-tab-pane>

            <el-tab-pane label="LLM对话" name="llm">
              <div class="demo-showcase">
                <div class="demo-visual">
                  <div class="mockup-interface">
                    <div class="mockup-header">
                      <span>LLM智能对话</span>
                    </div>
                    <div class="mockup-content">
                      <div class="mockup-chat">
                        <div class="chat-message assistant">
                          <div class="message-avatar">AI</div>
                          <div class="message-content">
                            您好！我是您的AI助手，可以帮您进行多语言翻译、文本分析和内容生成。
                          </div>
                        </div>
                        <div class="chat-message user">
                          <div class="message-avatar">用户</div>
                          <div class="message-content">
                            请帮我将这句话翻译成越南语："一带一路倡议促进区域合作"
                          </div>
                        </div>
                        <div class="chat-message assistant">
                          <div class="message-avatar">AI</div>
                          <div class="message-content">
                            越南语翻译："Sáng kiến Một vành đai, một con đường thúc đẩy hợp tác khu vực"
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="demo-details">
                  <h3>智能LLM对话</h3>
                  <p>集成先进的大语言模型，提供自然流畅的多语言对话体验。系统支持文本翻译、内容生成、智能问答等功能，是您工作和学习的得力助手。</p>

                  <div class="feature-list">
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>多语言对话支持</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>上下文理解</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>专业领域知识</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>实时响应</span>
                    </div>
                    <div class="feature-item">
                      <el-icon class="feature-icon"><Check /></el-icon>
                      <span>对话历史记录</span>
                    </div>
                  </div>

                  <div class="demo-actions">
                    <el-button color="var(--primary)" type="primary" size="large" @click="$router.push('/llmprocess')">
                      立即体验
                    </el-button>
                  </div>
                </div>
              </div>
            </el-tab-pane>
          </el-tabs>
        </div>
      </section>

      <!-- 使用统计 -->
      <section class="usage-stats">
        <div class="stats-container">
          <h3>系统使用统计</h3>
          <div class="stats-grid">
            <div class="stat-card">
              <div class="stat-icon">
                <el-icon><Operation /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">12,580</div>
                <div class="stat-label">文本对齐次数</div>
              </div>
            </div>
            <div class="stat-card">
              <div class="stat-icon">
                <el-icon><SetUp /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">34,620</div>
                <div class="stat-label">数据处理量</div>
              </div>
            </div>
            <div class="stat-card">
              <div class="stat-icon">
                <el-icon><Search /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">8,940</div>
                <div class="stat-label">检索查询次数</div>
              </div>
            </div>
            <div class="stat-card">
              <div class="stat-icon">
                <el-icon><ChatDotRound /></el-icon>
              </div>
              <div class="stat-info">
                <div class="stat-number">25,300</div>
                <div class="stat-label">AI对话次数</div>
              </div>
            </div>
          </div>
        </div>
      </section>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { Operation, SetUp, Search, ChatDotRound, Upload, Check } from '@element-plus/icons-vue'
import UserHomeHeader from '@/components/UserHomeHeader.vue'

const activeDemo = ref('align')

const handleDemoChange = (tab) => {
  console.log('切换到演示:', tab.props.name)
}
</script>

<style scoped>
.features-demo-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.features-demo {
  flex: 1;
}

/* 页面标题样式 */
.page-header {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-card) 100%);
  padding: 60px 20px;
  text-align: center;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
}

.header-content h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-strong);
  margin-bottom: 15px;
}

.header-content p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* 功能演示内容样式 */
.demo-content {
  padding: 60px 20px;
  max-width: 1400px;
  margin: 0 auto;
}

.demo-tabs {
  width: 100%;
}

.demo-showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: start;
  padding: 40px 0;
}

.demo-visual {
  display: flex;
  justify-content: center;
}

.mockup-interface {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  border: 1px solid var(--border);
}

.mockup-header {
  background: var(--primary-light);
  padding: 15px 20px;
  font-weight: 600;
  color: var(--primary-strong);
  border-bottom: 1px solid var(--border);
}

.mockup-content {
  padding: 20px;
  min-height: 300px;
}

/* 文本对齐演示样式 */
.mockup-upload {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.upload-area:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.mockup-result {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.result-item:last-child {
  border-bottom: none;
}

.chinese {
  color: var(--text-primary);
  font-weight: 500;
}

.vietnamese {
  color: var(--text-secondary);
}

/* 数据清洗演示样式 */
.mockup-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
}

.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-bottom: 8px;
}

.step-text {
  font-size: 12px;
  color: var(--text-secondary);
}

.step-arrow {
  color: var(--primary);
  font-weight: bold;
  margin: 0 5px;
}

.mockup-stats {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
}

.stat-label {
  color: var(--text-secondary);
}

.stat-value {
  color: #e74c3c;
  font-weight: 600;
}

/* 数据检索演示样式 */
.mockup-search {
  margin-bottom: 20px;
}

.mockup-results {
  border-top: 1px solid var(--border);
  padding-top: 15px;
}

.result-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.result-item.highlighted {
  background: var(--primary-light);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--primary);
}

.result-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.result-snippet {
  font-size: 14px;
  color: var(--text-secondary);
}

.highlight {
  background: yellow;
  padding: 1px 2px;
  border-radius: 2px;
}

/* LLM对话演示样式 */
.mockup-chat {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: 300px;
  overflow-y: auto;
}

.chat-message {
  display: flex;
  gap: 10px;
}

.chat-message.user {
  flex-direction: row-reverse;
}

.message-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-message.user .message-avatar {
  background: var(--text-secondary);
}

.message-content {
  background: var(--bg-page);
  padding: 12px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  max-width: 80%;
  line-height: 1.5;
}

.chat-message.assistant .message-content {
  border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
  background: var(--primary-light);
  border-bottom-right-radius: 4px;
}

/* 功能详情样式 */
.demo-details h3 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}

.demo-details p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 30px;
}

.feature-list {
  margin-bottom: 40px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.feature-item:last-child {
  border-bottom: none;
}

.feature-icon {
  color: var(--primary);
  font-size: 18px;
  flex-shrink: 0;
}

.demo-actions {
  display: flex;
  gap: 15px;
}

/* 使用统计样式 */
.usage-stats {
  background: var(--bg-page);
  padding: 60px 20px;
}

.stats-container {
  max-width: 1200px;
  margin: 0 auto;
}

.stats-container h3 {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 40px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
}

.stat-card {
  background: var(--bg-card);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(139, 92, 246, 0.15);
}

.stat-card .stat-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--primary-strong);
  flex-shrink: 0;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 14px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .header-content h1 {
    font-size: 2rem;
  }

  .demo-showcase {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .demo-actions {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .mockup-steps {
    flex-direction: column;
    gap: 15px;
  }

  .step-arrow {
    transform: rotate(90deg);
  }
}
</style>